module.exports = app => {
  const mongoose = app.mongoose
  const { Schema } = mongoose
  const { ObjectId } = Schema

  const modelSchema = new Schema({
      title: { type: String, remark: '告警标题' },
      action: { type: ObjectId, ref: 'action', remark: '告警方式' },
      point: { type: Object, remark: '告警数据' },
      server: { type: ObjectId, ref: 'server', remark: '服务器' },
      user: { type: ObjectId, ref: 'user', remark: '用户' },
    },
    {
      collections: 'error',
      timestamps:
        true,
    },
  )

  return mongoose.model('error', modelSchema)
}